from django.db import models


# Create your models here.

class customers(models.Model):
    name = models.CharField(max_length=20)
    email = models.CharField(max_length=2, unique=True)
    password = models.CharField(max_length=20)
    phone = models.CharField(max_length=20)
    create_time = models.DateTimeField(auto_now_add=True)
    update_time = models.DateTimeField(auto_now=True)


class orders(models.Model):
    product_name = models.CharField(max_length=20)
    quantity = models.IntegerField(max_length=20)
    price = models.DecimalField(max_digits=6, decimal_places=2)
    order_date = models.DateTimeField(auto_now_add=True)
    status = models.CharField(max_length=20)
    customer_id = models.ForeignKey(customers, on_delete=models.CASCADE, related_name='orders')
